#include <zmq.hpp>
#include <iostream>
#include <string>
#include "ZQ_CPP_LIB/time_cost.hpp"
#include "share.hpp"

int main(){
  zmq::context_t context(1);
  zmq::socket_t socket(context,ZMQ_REQ);
  std::cout<<"Connecting to hello world server..."<<std::endl;
  std::string server_host = "tcp://"+server_ip+":"+server_port;
  socket.connect(server_host);

  for (int request_nbr = 0; request_nbr!=n+10; request_nbr++){
    zmq::message_t request(size);
    socket.send(request);
    zmq::message_t reply;
    socket.recv(&reply);
    int cnt = request_nbr+1;
    if (cnt==1){
      zq_cpp_lib::get_start_time();
    };
    if (cnt==n){
      zq_cpp_lib::get_end_time();
      double timecost_ms = zq_cpp_lib::get_cost_time_by_ms();
      std::cout<<"time cost(ms) = " << timecost_ms<<std::endl;
    };
    if (cnt%(n/100)==0){
      std::cout<<"cnt="<<cnt<<std::endl;
      std::cout<<"reply.size()="<<reply.size()<<std::endl;
    };
  };
  return 0;
};
